package cn.webdai.rabbitmq.example_02;

import cn.webdai.rabbitmq.pojo.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 消息发送者 ----发送对象
 * @author 戴金华
 * @date 2019-12-04 15:49
 */
@Component
public class MessageSend2 {

    @Autowired
    private AmqpTemplate amqpTemplate;


    public void send(User user){
        System.out.println("发送的对象内容: "+user.toString());
        this.amqpTemplate.convertAndSend("object",user);
    }
}
